1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.AppChooserT;
26 
27 public  import gio.AppInfoIF;
28 public  import glib.Str;
29 public  import glib.c.functions;
30 public  import gobject.ObjectG;
31 public  import gtk.c.functions;
32 public  import gtk.c.types;
33 
34 
35 /**
36  * `GtkAppChooser` is an interface for widgets which allow the user to
37  * choose an application.
38  * 
39  * The main objects that implement this interface are
40  * [class@Gtk.AppChooserWidget],
41  * [class@Gtk.AppChooserDialog] and [class@Gtk.AppChooserButton].
42  * 
43  * Applications are represented by GIO `GAppInfo` objects here.
44  * GIO has a concept of recommended and fallback applications for a
45  * given content type. Recommended applications are those that claim
46  * to handle the content type itself, while fallback also includes
47  * applications that handle a more generic content type. GIO also
48  * knows the default and last-used application for a given content
49  * type. The `GtkAppChooserWidget` provides detailed control over
50  * whether the shown list of applications should include default,
51  * recommended or fallback applications.
52  * 
53  * To obtain the application that has been selected in a `GtkAppChooser`,
54  * use [method@Gtk.AppChooser.get_app_info].
55  */
56 public template AppChooserT(TStruct)
57 {
58 	/** Get the main Gtk struct */
59 	public GtkAppChooser* getAppChooserStruct(bool transferOwnership = false)
60 	{
61 		if (transferOwnership)
62 			ownedRef = false;
63 		return cast(GtkAppChooser*)getStruct();
64 	}
65 
66 
67 	/**
68 	 * Returns the currently selected application.
69 	 *
70 	 * Returns: a `GAppInfo` for the
71 	 *     currently selected application
72 	 */
73 	public AppInfoIF getAppInfo()
74 	{
75 		auto __p = gtk_app_chooser_get_app_info(getAppChooserStruct());
76 
77 		if(__p is null)
78 		{
79 			return null;
80 		}
81 
82 		return ObjectG.getDObject!(AppInfoIF)(cast(GAppInfo*) __p, true);
83 	}
84 
85 	/**
86 	 * Returns the content type for which the `GtkAppChooser`
87 	 * shows applications.
88 	 *
89 	 * Returns: the content type of @self. Free with g_free()
90 	 */
91 	public string getContentType()
92 	{
93 		auto retStr = gtk_app_chooser_get_content_type(getAppChooserStruct());
94 
95 		scope(exit) Str.freeString(retStr);
96 		return Str.toString(retStr);
97 	}
98 
99 	/**
100 	 * Reloads the list of applications.
101 	 */
102 	public void refresh()
103 	{
104 		gtk_app_chooser_refresh(getAppChooserStruct());
105 	}
106 }